package DAO;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import MODEL.Vermifugacao;

public class VermifugacaoDAO {
	public static boolean CadastrarVermifugacao(Vermifugacao vermifugacao) throws InstantiationException, Throwable{
		Connection conn=null;
		PreparedStatement stmt=null;
		Conexao com=new Conexao();
		boolean status=false;
	
		try{
		conn=com.getConnection();
		
		}catch (SQLException e) {
			e.printStackTrace();
		}
		try{
		stmt=conn.prepareStatement("Insert into vermifugacoes(idAnimal,Data_da_Vermifugacao,Tipo_de_Vermifugo,Marca,Partida,Lote,Vencimento,Reforco) value(?,?,?,?,?,?,?,?)");
		stmt.setInt(1,vermifugacao.getIdAnimal());
		stmt.setString(2,vermifugacao.getDatadaVermifugacao());
		stmt.setString(3,vermifugacao.getTipodeVermifugacao());
		stmt.setString(4,vermifugacao.getMarca());
		stmt.setString(5,vermifugacao.getPartida());
		stmt.setString(6,vermifugacao.getLote());
		stmt.setString(7, vermifugacao.getVencimento());
		stmt.setString(8, vermifugacao.getReforco());
		
		stmt.execute();
		status=true;
		}
		catch (SQLException e) {
			e.printStackTrace();
		}
		return status;
	}

}
